home *** CD-ROM | disk | FTP | other *** search
- /* UUEncode.ged by Troels Walsted Hansen <troelsh@powertech.no>
- ** $VER: UUEncode.ged v1.20 (11.08.95)
- **
- ** An ARexx script that uuencodes a file and imports it into the
- ** GoldED you are currently using. Unless the file is already
- ** archived this script will optionally do it for you (using LhA).
- **
- ** Utilises LhA by Stefan Boberg and either of the following:
- ** · UUFast v1.25 by Jørn Halonen
- ** · uuIn v1.03 by Nicolas Dade
- ** · UUxT v3.1 by Asher Feldman
- **
- ** Hitory
- ** ¯¯¯¯¯¯
- ** UUEncode.ged v1.10 (09.06.95)
- ** · uses GoldED's requester-commands instead of THOR's
- **
- ** UUEncode.ged v1.20 (11.08.95)
- ** · added the uuprogpath user variable
- ** · now disregards case in uudecoder variable setting
- */
-
- /* some user variables. edit to your hearts content */
-
- tmpdir = "T:" /* Work dir for the encoding */
- uuencoder = "uuin" /* may be: "uuin", "uufast" or "uuxt" */
- uuprogpath = "C:" /* Path to your uuencoder. This path */
- /* MUST end with either ':' or '/'. */
-
- /* do NOT edit below here unless you know what you're doing :-) */
-
- options results
-
- /* needs GoldED and bbsread.library functions */
-
- if(substr(address(),1,6) ~= "GOLDED") then
- do
- say "This script should only be started from inside GoldED."
- exit 20
- end
- else gedport = address()
-
- if ~show('p', 'BBSREAD') then
- do
- address command
- "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
- "WaitForPort BBSREAD"
- end
-
- /* get filename */
-
- address(bbsread)
- GETGLOBALDATA STEM GLOBALDATA
-
- address(gedport)
- REQUEST TITLE '"Select file to encode:"' FILE PATH '"'GLOBALDATA.UPLOADPATH'"' MASK '"#?"' VAR filetoencode
- if(rc ~= 0) then exit
-
- lastchar = right(filetoencode,1)
-
- if(lastchar = "/" | lastchar = ":" | filetoencode = "") then
- do
- REQUEST BODY '"No file selected!"' BUTTON '"_Ok"' TITLE '"Error"' VAR result
- signal exit
- end
-
- posi = lastpos("/",FileToEncode)
- if(posi = 0) then posi = lastpos(":",FileToEncode)
- WithoutPath = substr(FileToEncode,posi+1)
-
- /* if file isn't LhA'ed -- do it ourselves */
-
- extension = upper(substr(FileToEncode, lastpos(".",FileToEncode)+1))
-
- if~(extension = "LHA" | extension = "LZH") then
- do
- REQUEST BODY '"Do you want to LhA the file?"' BUTTON '"_Yes|_No"' TITLE '"UUEncode.ged"' VAR result
- if(result) then
- do
- address command "LhA >nil: -y -q a "||'"'tmpdir||WithoutPath'"'||" "||'"'FileToEncode'"'
-
- if(rc ~= 0) then REQUEST BODY '"LhA''ing did not succeed."' BUTTON '"_Ok"' TITLE '"UUEncode.ged"' VAR result
- else FileToEncode = tmpdir||WithoutPath||".lha"
- end
- end
-
- select
- when(upper(uuencoder) = 'UUFAST') then cmd = uuprogpath || 'UUFast >nil: ' || '"' || filetoencode || '"' || " TO " || tmpdir || "Message.uu E"
- when(upper(uuencoder) = 'UUIN') then cmd = uuprogpath || 'uuIn >nil: INFILE=' || '"' || filetoencode || '"' || " OUTFILE=" || tmpdir || "Message.uu"
- when(upper(uuencoder) = 'UUXT') then cmd = uuprogpath || 'UUxT >nil: a ' || tmpdir || 'Message.uu ' || '"'filetoencode'"'
- otherwise
- do
- REQUEST BODY '"UUEncoder not configured correctly."' BUTTON '"_Ok"' TITLE '"UUEncode.ged"' VAR result
- signal exit
- end
- end
- address command cmd
-
- if ~exists(tmpdir"Message.uu") then
- do
- REQUEST BODY '"Something went wrong during uuencoding."' BUTTON '"_Ok"' TITLE '"UUEncode.ged"' VAR result
- signal exit
- end
-
- address(gedport)
- OPEN NAME '"' || tmpdir || 'Message.uu' || '"' FAST INSERT
-
- /* cleanup and exit */
-
- exit:
- if(exists(tmpdir || WithoutPath || ".lha")) then address command 'delete >nil: ' || '"' || tmpdir || WithoutPath || '.lha' || '"'
- if(exists(tmpdir || "Message.uu")) then address command 'delete >nil: ' || tmpdir || 'Message.uu'
- exit
-